#coding :utf-8


class RemoteManage(object):
    _instance = {}
    def __new__(cls, *args, **kwargs):
        if cls not in cls._instance:
            cls._instance[cls] = super(RemoteManage, cls).__new__(cls, *args, **kwargs)
        print cls._instance
        return cls._instance[cls]

    def __init__(self):
        self.all_remotePC = {}

    def pushRemote(self, key, XunleiRemote):
        self.all_remotePC[key.strip()] = XunleiRemote

    def popRemote(self, key):
        return self.all_remotePC[key.strip()]

class XunleiRemote(object):
    
    def __init__(self, map):
        self.remote_Fied = {"name":'', "uid":'', "status":'0', "cunrrent_task":[]}
        self.getRemoteInfo(map)
        print self.remote_Fied

    def getRemoteInfo(self, map):
        for key in self.remote_Fied.keys():
            if(map.has_key(key)):
                self.remote_Fied[key] = map[key]
            else:
                pass

    def getRemoteName(self):
        return self.remote_Fied["name"]

    def getRemoteStatus(self):
        return self.remote_Fied["status"]